<?php
class Merchant_Model_Validate_HkupsValidate extends Merchant_Model_Validate_CommonValidate{

    public function validator(){
		$this->PublicValidator();
		$this->orderProduct();			//物品描述
		$this->consigneeRegion();		//收件人州
		$this->consigneeCity();
		$this->consigneeZip();			//邮编
		$this->consigneePhone();		//电话
		$this->parcelDeclaredValue();	//物品申报价值
	
        return $this->_error;
    }
    
    //收件人地址
	public function address(){

        $address1Len = 50;
		$address2Len = 50;
        $regex[1] = array('name' => '收件地址1','value' => $this->consignee_address1,'regex' => array('require','noCharacter','length[5,'.$address1Len.']'));
        $regex[2] = array('name' => '收件地址2','value' => $this->consignee_address2,'regex' => array('noCharacter','length[0,'.$address2Len.']'));     
		$error= Default_Service_Validator::formValidator($regex);

		if(!empty($error)){
			foreach ($error as $one){
			    $this->_error[] = $one ;
			}
		}
	}
    
	
    //邮编
	public function consigneeZip(){
		$regex = array('name' => '收件邮编','value' => $this->consignee_zip,'regex' =>array('length[1,255]','noCharacter'));
		$error=Default_Service_Validator::Validator($regex);
		if(!empty($error)){
			$this->_error[] = $error ;
		}
	}
    
	//电话
	public function consigneePhone(){
 		$regex = array('name' =>  '电话号码','value' => $this->consignee_phone,'regex' => array('length[1,30]','noCharacter','require'));
		$error = Default_Service_Validator::Validator($regex);
		if(!empty($error)){
			$this->_error[] = $error ;
		}
	}
	
	//收件人城市
	public function consigneeCity(){
        $regex = array('name' => '收件人城市','value' => $this->consignee_city,'regex' => array('length[1,255]','noCharacter','require'));
		$error = Default_Service_Validator::Validator($regex);
		if(!empty($error)){
			$this->_error[] = $error ;
		}
	}
	
	//收件人州
	public function consigneeRegion(){
		$regex = array('name' => '收件人州/区域','value' => $this->consignee_region,'regex' => array('length[1,128]','noCharacter'));
		$error = Default_Service_Validator::Validator($regex);
		if(!empty($error)){
			$this->_error[] = $error ;
		}
	}
    
}
?>